/**
*      author: Y_Yao
*      created: 2024-11-30 20:54:58
**/

#include<bits/stdc++.h>

using namespace std;
#define int LL
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
int n,m;
vector<int> ret;
vector<vector<int>> v;

void dfs(int step,int now)
{
    if(ret.size() == n)
    {
        v.push_back(ret);
        return;
    }

    for(int i = now;i + (n - step) * 10 <= m;i++)
    {
        ret.push_back(i);
        dfs(step + 1,i + 10);
        ret.pop_back();
    }
}

void solve()
{
    cin >> n >> m;
    dfs(1,1);
    int tn = v.size();
    cout << tn << endl;
    for(int i = 0;i < tn;i++)
    {
        for(auto e : v[i])
        {
            cout << e << " ";
        }
        cout << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}